package hd.cls2;

import java.util.HashMap;
import java.util.Map;

/**
 * @author oldliu
 * @since 1.0
 */
public class MapTest {
    public static void main(String[] args) {
        Map<String,String> map=new HashMap<>();
        map.put("点头","yes");
        map.put("摇头","no");
        map.put("狗","dog");
        map.put("苹果","apple");
        map.put("桌子","desk");
        map.put("桌子","table");
        System.out.println(map.size());
        System.out.println(map);
        String v=map.get("苹果");
        System.out.println(v);
        System.out.println("------------迭代-----------------");
        for(String k:map.keySet()){
            String value=map.get(k);
            System.out.println(k+"--->"+value);
        }
        System.out.println("------------迭代2-----------------");
        for (Map.Entry<String, String> ent : map.entrySet()) {
            System.out.println(ent.getKey()+"--->"+ent.getValue());
        }

    }
}
